import request from '@/utils/request'

// 创建投票结果
export function createUserResult(data) {
  return request({
    url: '/vote/user-result/create',
    method: 'post',
    data: data
  })
}

// 更新投票结果
export function updateUserResult(data) {
  return request({
    url: '/vote/user-result/update',
    method: 'put',
    data: data
  })
}

// 删除投票结果
export function deleteUserResult(id) {
  return request({
    url: '/vote/user-result/delete?id=' + id,
    method: 'delete'
  })
}

// 获得投票结果
export function getUserResult(id) {
  return request({
    url: '/vote/user-result/get?id=' + id,
    method: 'get'
  })
}

// 获得投票结果分页
export function getUserResultPage(query) {
  return request({
    url: '/vote/user-result/page',
    method: 'get',
    params: query
  })
}

// 获得投票结果分页
export function getUserResultNamePage(query) {
  return request({
    url: '/vote/user-result/pageName',
    method: 'get',
    params: query
  })
}


// 导出投票结果 Excel
export function exportUserResultExcel(query) {
  return request({
    url: '/vote/user-result/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 下载用户导入模板
export function importTemplate() {
  return request({
    url: '/vote/user-result/get-import-template',
    method: 'get',
    responseType: 'blob'
  })
}


// 获得投票结果分页
export function synResult(query) {
  return request({
    url: '/vote/user-result/syn-result',
    method: 'get',
    params: query
  })
}
